<?php

$services = getenv("VCAP_SERVICES");
if ($services==''&&!defined('SAE_MYSQL_USER')) { 
	define('DB_NAME', 'mgjhxvredi_core');
	define('DB_USER', 'mgjhxvredi_core');
	define('DB_PASSWORD','tanLVemGvW');
	define('DB_HOST', 'localhost');
	define('DB_PORT', '3306');
	define('SHOW_SCRIPT_NAME',false);
}else if(defined('SAE_MYSQL_USER')){
	//for sina app engine
	define('DB_NAME', SAE_MYSQL_DB);
	define('DB_USER', SAE_MYSQL_USER);
	define('DB_PASSWORD', SAE_MYSQL_PASS);
	define('DB_HOST', SAE_MYSQL_HOST_M);
	define('DB_PORT', SAE_MYSQL_PORT);
	define('SHOW_SCRIPT_NAME',false);
}else{
	//for  sheng da egine
	$services_json = json_decode($services,true);
	$mysql_config = $services_json["mysql-5.1"][0]["credentials"];
	// ** MySQL settings from resource descriptor ** //
	define('DB_NAME', $mysql_config["name"]);
	define('DB_USER', $mysql_config["user"]);
	define('DB_PASSWORD', $mysql_config["password"]);
	define('DB_HOST', $mysql_config["hostname"]);
	define('DB_PORT', $mysql_config["port"]);
	define('SHOW_SCRIPT_NAME',true);
}
// This is the configuration for yiic console application.
// Any writable CConsoleApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'My Console Application',
	'components'=>array(
		'db'=>array(
			'connectionString' => 'mysql:host='.DB_HOST.';dbname='.DB_NAME,
			'emulatePrepare' => true,
			'username' => DB_USER,
			'password' => DB_PASSWORD,
			'charset' => 'utf8',
			'tablePrefix' => 'tbl_',
		),
	),
	'modules'=>array(
		
        #...
        'user'=>array(
            # encrypting method (php hash function)
            'hash' => 'md5',
 
            # send activation email
            'sendActivationMail' => true,
 
            # allow access for non-activated users
            'loginNotActiv' => false,
 
            # activate user on registration (only sendActivationMail = false)
            'activeAfterRegister' => false,
 
            # automatically login from registration
            'autoLogin' => true,
 
            # registration path
            'registrationUrl' => array('/user/registration'),
 
            # recovery password path
            'recoveryUrl' => array('/user/recovery'),
 
            # login form path
            'loginUrl' => array('/user/login'),
 
            # page after login
            'returnUrl' => array('/user/profile'),
 
            # page after logout
            'returnLogoutUrl' => array('/user/login'),
        ),
    ),
);